# Replication archive for: Alexander Coppock, Kimberly Gross, Ethan Porter, Emily Thorson, and Thomas J. Wood, 
# "Conceptual Replication of Four Key Findings about Factual Corrections and Misinformation during the 2020 US Election: Evidence from Panel-Survey Experiments." 
# Forthcoming in the British Journal of Political Science doi:10.1017/S0007123422000631

library(tidyverse)

t5 <- read_rds("data/cume_fc_views.rds")
t5l <- read_rds("data/final_fc_views.rds")
t6 <- read_rds("data/int_dates_for_fc_views.rds")


t5 %>% 
  ggplot() +
  geom_rect(
    aes(
      xmin = start, 
      xmax = end
    ),
    linewidth = .1,
    fill = "white",
    color = "grey2",
    ymin = -30000,
    ymax = 5.35e05,
    data = t6 %>% 
      na.omit
    ) +
  geom_line(
    aes(
      rd2, cume_views, linetype = congeniality, 
      group = fn
    ),
    linewidth = .5
  ) +
  geom_point(
    aes(
      rd2, cume_views
    ),
    size = 9,
    shape = 21,
    fill = "white",
    data = t5l
    ) +
  geom_text(
    aes(
      rd2, cume_views, label = lab
    ),
    family =  "Roboto",
    fontface = "italic",
    size = 2.25,
    data = t5l
  ) +
  geom_text(
    aes(
      x, y, label = lab
    ),
    data = tribble(
      ~x, ~y, ~lab,
      "2020-09-20" %>% as.Date, 300e3, "False claim\ncongenial\nto Reps.",
      "2020-09-10" %>% as.Date, 205e3, "False claim\ncongenial\nto Dems."
      ) %>% 
      mutate(
        topic_short = c(
          "Hunter Biden's laptop had photos torturing children",
          "Donald Trump claimed his DNA was USA"
        ) %>% 
          factor(
            t5l$topic_short %>% 
              levels
            )
        ),
    family = 'Roboto',
    fontface= "italic",
    size = 3,
    lineheight = .75, 
    hjust = 0
  ) +
  geom_text(
    aes(
      x, y, label = lab
    ),
    data = tribble(
      ~x, ~y, ~lab,
      "2020-10-20" %>% as.Date, 400e3, "Survey\nfielding\nperiod"
      ) %>% 
      mutate(
        topic_short = "GOP voters' pens invisible to voting machines" %>% 
          factor(
            t5l$topic_short %>% 
              levels
          )
      ),
    family = 'Roboto',
    fontface= "italic",
    size = 3,
    lineheight = .75, 
    hjust = 0
  ) +
  scale_y_continuous(
    breaks = seq(0, 500e3, 250e3),
    labels = c(0, 250, 500),
    expand  = expansion(add = c(45000, 45000))
  ) +
  facet_wrap(
    ~ topic_short, 
    nrow = 3,
    labeller = label_wrap_gen(25)
    )  +
  labs(
    x = "",
    y = "Cumulative views of fact check (000s of visits)"
  ) +
  theme(
    legend.position = "none"
  )
